package cn.gqr.service;

import cn.gqr.dao.TypeDao;
import cn.gqr.entity.Type;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class TypeServiceImpl implements TypeService{

    @Autowired
    TypeDao td;

    @Override
    public List<Type> getTypeAll() {
        return td.getTypeAll();
    }

    @Override
    public Map findByPage(int start) {
        Map map = new HashMap();
        map.put("types",td.findByPage(start));
        map.put("total",td.findByPageCount());
        return map;
    }

    @Override
    public Type findById(String id) {
        return td.findById(id);
    }

    @Override
    public boolean del(String id) {
        return td.del(id);
    }

    @Override
    public Type add(Type type) {
        return td.add(type);
    }

    @Override
    public boolean upByIdType(Type type) {
        return td.upByIdType(type);
    }
}
